﻿using System.Collections.Generic;
using UnityEngine;

public static class Utillity
{
    public static void AddList(this List<int> lis,params int[] ins)
    {
        if (lis == null || ins == null)
        {
            return;
        }
        for (int i = 0; i < ins.Length; i++)
        {
            lis.Add(ins[i]);
        }
    }
    public static void AddList(List<Vector2> lvs, params Vector2[] vs)
    {
        if (lvs == null || vs == null)
        {
            return;
        }
        for (int i = 0; i < vs.Length; i++)
        {
            lvs.Add(vs[i]);
        }
    }
    
    public static void AddList(this List<Vector3> lvs,GameObject prefab,Transform parent, params Vector3[] vs)
    {
        if (lvs == null || vs == null)
        {
            return;
        }
        for (int i = 0; i < vs.Length; i++)
        {
            //ST(prefab, vs[i], parent, lvs.Count.ToString());
            lvs.Add(vs[i]);
        }
    }

    public static void ST(GameObject prefab, Vector3 p, Transform pre, string n = "")
    {
        GameObject i = GameObject.Instantiate(prefab, pre);
        i.name = n;

        i.transform.localPosition = p - pre.localPosition;
        i.SetActive(true);
    }
}
